﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Direct.Modularity;
using Direct.Core;

namespace Direct.Product
{
    class ProductService : IProductService
    {
        public string ProductName
        {
            get { return "Direct Web App Server"; }
        }

        public string ProductVersion
        {
            get { return "2.5.11.0701"; }
        }

        public ILicenseInformation GetLicenseInformation()
        {
            return new LicenseInformation();
        }

        private class LicenseInformation : ILicenseInformation
        {

            public string OwnerName
            {
                get { return "Marcelo Dezem"; }
            }

            public string CompanyName
            {
                get { return "MDZN"; }
            }

            public string CompanyComercialName
            {
                get { return "MDZN"; }
            }
        }

        public List<string> GetInstalledModules()
        {
            return ServiceLocator
                .GetInstance<IModuleCatalog>()
                .Modules
                .OrderBy(m => m.LoadOrderIndex)
                .Select(m => "{0} [{1}]".Templ(m.ModuleDescription, m.ModuleName))
                .ToList();
        }
    }
}
